package com.engine4cloud.tdf.supervision.convert;

import com.engine4cloud.tdf.common.core.constant.enums.ComplexAuditActionStatusEnum;
import com.engine4cloud.tdf.common.core.util.CodeUtils;
import com.engine4cloud.tdf.supervision.dto.create.SpRevokeProbationCreateDTO;
import com.engine4cloud.tdf.supervision.dto.result.SpRevokeProbationResultDTO;
import com.engine4cloud.tdf.supervision.dto.update.SpRevokeProbationUpdateDTO;
import com.engine4cloud.tdf.supervision.entity.SpRevokeProbationEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface SpRevokeProbationConvert {
    SpRevokeProbationConvert INSTANCE = Mappers.getMapper(SpRevokeProbationConvert.class);

    SpRevokeProbationResultDTO convert(SpRevokeProbationEntity s);

    SpRevokeProbationEntity create(SpRevokeProbationCreateDTO s);

    SpRevokeProbationEntity update(SpRevokeProbationUpdateDTO s);

    default SpRevokeProbationEntity create(SpRevokeProbationCreateDTO s, Long tenantId, ComplexAuditActionStatusEnum action) {
        SpRevokeProbationEntity entity = create(s);
        entity.setTenantId(tenantId);
        entity.setLcbh(CodeUtils.entrustCode());
        entity.setPreAction(action);
        return entity;
    }
}
